package com.mubolg.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import com.mubolg.result.R;
import com.mubolg.service.IDriverService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jdk.jfr.Period;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@Tag(name = "小程序司机对象",description = "小程序司机对象")
@RestController
@RequestMapping("/app/driver")
public class AppDriverController {
    @Autowired
    private IDriverService driverService;

    //获取对象
    @Operation( summary= "小程序司机注册",description = "小程序司机注册接口")
    @Parameter(name = "openIdCode",description = "获取openId的code",required = true)
    @GetMapping("/register/{openIdCode}/{phoneCode}")
    @SaIgnore
    public R get(@PathVariable("openIdCode") @NotNull(message = "参数不能为空") String openIdCode,@PathVariable("phoneCode") @NotNull(message = "参数不能为空") String phoneCode) throws Exception {
        driverService.register(openIdCode,phoneCode);
        return R.success();
    }


}
